﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using ITOMMS.Entity;


namespace ITOMMS.Web.Dispatch
{
    public partial class DispatchShow : BasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Request.Params["id"] != null)
                {
                    string sid = Request.Params["id"].ToString();
                    int pid = 0;
                    if (int.TryParse(sid, out pid))
                    {
                        DataShow(pid);
                    }
                }
            }
        }

        private void DataShow(int dispatchId)
        {
            VwDispatchEntity entity = new VwDispatchEntity();
            entity = entity.FindEntity("ID=" + dispatchId);
            if (entity != null)
            {
                this.lblTaskSource.Text = System.Enum.GetName(typeof(Business.PubEnums.TaskSource),entity.TaskSource);
                this.lblDispatchDescription.Text = entity.DispatchDescription;
                this.lblExpectTime.Text = entity.ExpectTime.ToString();
                this.lblFeedback.Text = entity.Feedback;
                this.lblNextDepartment.Text = entity.NextDepartmentName.ToString();
                this.lblNextPerson.Text = entity.NextPersonName.ToString();
                this.lblOwnerCompnayID.Text = entity.CompanyName.ToString();
                this.lblRequestPeople.Text = entity.RequestPeopleName.ToString();
                this.lblState.Text = System.Enum.GetName(typeof(Business.PubEnums.DispatchState), entity.State);
                this.lblTransactComments.Text = entity.TransactComments;
                this.lblServiceID.Text = entity.ServiceName.ToString();
            }
        }

        protected void btnBack_ServerClick(object sender, EventArgs e)
        {
            Response.Redirect("DispatchList.aspx");
        }
    }
}
